using System;
using System.Linq;
using YatFram.Browser;
using YatFram.Browser.CssSelector;

namespace Examples.Google
{
    public class GoogleBrowser  : IDisposable
    {
        private readonly IBrowser _browser;

        public GoogleBrowser(IBrowser browser)
        {
            _browser = browser;
        }

        public Homepage Homepage
        {
            get { return new Homepage(_browser.Find("input[name='f']".ToCssSelector()).First()); }
        }

        public SearchResults SearchResults
        {
            get { return new SearchResults(_browser.Find("#search".ToCssSelector()).First()); }
        }

        public string Dump()
        {
            return _browser.Dump();
        }

        public void Dispose()
        {
            _browser.Dispose();
        }
    }
}